﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RulesCore
{
    public enum Op
    {
        OR, AND
    };


    class AndOrRule : BaseRule
    {
        BaseRule first;
        BaseRule seceond;
        Op op;

        public AndOrRule(BaseRule first, Op op, BaseRule seceond)
        {
            this.first = first;
            this.seceond = seceond;
            this.op = op;
        }


        public override bool ChekRule()
        {
            switch (op)
            {
                case Op.OR: return (this.first.ChekRule() || this.seceond.ChekRule());

                case Op.AND: return (this.first.ChekRule() && this.seceond.ChekRule());

                default:
                    return false;
            }
        }
    }
}
